package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	OrderSn     string  `gorm:"type:char(36);unique;"`
	UserId      int64   `gorm:"type:int"`
	GoodsId     int64   `gorm:"type:int"`
	OrderAmount float64 `gorm:"type:decimal(10,2);"`
	OrderStatus int     `gorm:"type:tinyint(1);default:1;"`
	Payment     int     `gorm:"type:tinyint(1);default:1;"`
}

func (o *Order) Create() error {
	return DB.Debug().Create(&o).Error
}
func (o *Order) Update(orderSn string, status int64) error {
	return DB.Debug().Model(&Order{}).Where("order_sn=?", orderSn).Update("order_status", status).Error
}
